using System;
using Jalal.Library.Web.Membership;
using Jalal.Library.Utility;
namespace BCGC.BLL.BusinessObject.UserAccount
{
    public abstract class UserBase : ISiteUser
    {
        protected int id;
        public int Id
        {
            get { return id; }
        }

        public abstract bool IsAdmin
        {
            get;
        }

        protected String username;
        public String Username
        {
            get{ return username; }
        }

        protected String password;
        public String Password
        {
            get {return password;}
            set {password = value;}
        }

        protected String email;
        public String Email
        {
            get{return email;}
            set{email = value;}
        }

        protected DateTime createDateTime;
        public DateTime CreateDateTime
        {
            get { return createDateTime; }
        }

        protected int invalidLoginCount;
        public int InvalidLoginCount
        {
            get {return invalidLoginCount;}
        }

        protected DateTime lastLoginTime;
        public DateTime LastLoginTime
        {
            get{return lastLoginTime;}
        }

        protected string EncryptPassword(string simplePassword)
        {
            return Security.Encrypt(simplePassword, Settings.SiteSettings.EncryptionKey, true);
        }

        protected string DecryptPassword(string encryptedPassword)
        {
            return Security.Decrypt(encryptedPassword, Settings.SiteSettings.EncryptionKey, true);
        }

        public abstract void Login(String username, String password);

        public abstract void Logout();
    }
}
